package com.next

class ProductItem {

    Double price
    // 单价

    String size
    // 尺寸

    String range
    // 规格

    Double freight = 0
    // 运费

    String description

    Boolean active = true

    Date createdDate = new Date()
    Date modifiedDate = new Date()

    static belongsTo = [product: Product]

    static constraints = {
        size unique: ['product']
        price blank: true, nullable: true
        range blank: true, nullable: true
        freight blank: true, nullable: true
        description blank: true, nullable: true
    }

    def beforeUpdate()
    {
        modifiedDate = new Date()
    }
}
